﻿using System;
using System.Collections.Generic;
using System.Linq;

using NUnit;
using NUnit.Framework;
using Rhino.Mocks;

namespace mForum.Infrastructure.NHibernate.Tests
{
    using mForum.Domain.DomainObject;
    using mForum.Core.Infrastructure;
    using mForum.Infrastructure.NHibernate;

    [TestFixture]
    public class DatabaseFactoryTests : BaseDatabaseTest
    {
        [Test]
        public void can_setup_connection()
        {
            DatabaseContext dbContext = _dbFactory.Get();

            Assert.IsNotNull(dbContext);
        }

        [Test]
        public void can_add_entity()
        {
            User testUser = new User()
            {
                Username = "mForum",
                Password = "test2",
                Email = "test@ble.pl",
                PasswordQuestion = "Who am asdasds?",
                PasswordAnswer = "asssdsade",
                isLockedOut = false,
                LastLoginDate = DateTime.Now,
                LastActivityDate = DateTime.Now,
                LastLockedOutDate = DateTime.Now,
                CreatedDate = DateTime.Now
            };

            _dbFactory.Get().Save<User>(testUser);
            _uow.Commit();
        }
    }
}
